<template>

    <div class="right">
      <keep-alive>
        <k-form-poi v-show="showForm"></k-form-poi>
      </keep-alive>
    </div>

</template>

<script>
import config from "@/config/global";
import { busEventEmit, busEventHandle } from "@/teleport/bus";

import FormPOI from "@/components/generate/FormPOI";

export default {
  name: "",
  data() {
    return {
      showForm: false,
      formComponentName: null,
      transport:null,
      formData: {
        rect:{
          id:null,
          area:null
        },
        pin:{
          id:null,
          coord:null,
          value:0
        }
      },
      toolButtonState: {
        pin: "text",
        rect: "text",
      },
      result: [],
    };
  },
  components: {
    "k-form-poi": FormPOI
  },
  methods: {
    listenConfigPOIEvent() {
      busEventHandle('request-config-poi',()=>{
        this.showForm = true;
      })
    },
    exportJSON() {
      let heatmap_parent = store.heatmapHistory.filter((e) => {
        return e.CLASS_NAME === "AMap.Polygon";
      })[0].getExtData();
      heatmap_parent.points = new Array();
      let heatmap_nodes = store.heatmapHistory.filter(e=>{
        return e.CLASS_NAME === 'AMap.Circle';
      });
      heatmap_nodes.forEach(o=>{
        heatmap_parent.points.push({
          coord:o.getExtData().coord,
          value:o.getExtData().value
        }) 
      });
      
      jsonDownloader(heatmap_parent, "heatmapp-list.json");
    },
  },
  created() {
    this.listenConfigPOIEvent();
  },
};
</script>

<style scoped>
</style>